// http://lx.lanqiao.cn/problem.page?gpid=T12
#include <iostream>
typedef long long ll;
using namespace std;

ll ans;
int main()
{
    int n;
    cin >> n;
    if (n < 3)
    {
        ans = 2;
        cout << ans << endl;
        return 0;
    }
    if (n % 2 != 0)
    {
        ans = (ll)n * (n - 1) * (n - 2);
    }
    else
    {
        if (n % 3)
            ans = (ll)n * (n - 1) * (n - 3);
        else
            ans = (ll)(n - 1) * (n - 2) * (n - 3);
    }
    cout << ans << endl;
    return 0;
}